﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace BestBuy
{
    public partial class ManagerView : System.Web.UI.MasterPage
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Session["TenDN"].ToString().Equals(""))
            {
                Response.Redirect("~/Account/Login.aspx");
                return;
            }
            Initialization();
        }

        private void Initialization()
        {
            if (Session["LoaiTK"].ToString().Equals("3"))
            { //NVQL
                string str = Request.Url.AbsolutePath;
                if (str.Contains("PageEditProfile") || str.Contains("PageChangePassword"))
                {
                    pnNVQL.Visible = false;
                    pnNVNS.Visible = false;
                    pnAccount.Visible = true;
                    return;
                }

                pnNVQL.Visible = true;
                pnNVNS.Visible = false;
                pnAccount.Visible = false;

            }
            else if (Session["LoaiTK"].ToString().Equals("4"))
            { //NVNS
                string str = Request.Url.AbsolutePath;
                if (str.Contains("PageEditProfile") || str.Contains("PageChangePassword"))
                {
                    pnNVQL.Visible = false;
                    pnNVNS.Visible = false;
                    pnAccount.Visible = true;
                    return;
                }
                pnNVQL.Visible = false;
                pnNVNS.Visible = true;
                pnAccount.Visible = false;
            }
            
        }

        protected void linkAcount_Click(object sender, EventArgs e)
        {
            Response.Redirect("~/PageAdmin/PageEditProfile.aspx");
        }

        protected void linkMyManager_Click(object sender, EventArgs e)
        {
            string loaitk = Session["LoaiTK"].ToString();
            if (loaitk.Equals("3"))
            {
                Response.Redirect("~/PageAdmin/PageProductManager.aspx");
            }
            else if (loaitk.Equals("4"))
            { 
                Response.Redirect("~/PageAdmin/PageUsersManager.aspx");
            }
        }
    }
}